/*
 * MenuBarDelegate.h  0.4.0 / Dec 05, 2010
 *
 * Copyright (c) 2010 - 2011, cute4j.com and contributors.
 *
 * This software is licensed under the LGPL version 2.1 license.
 * A copy of this license is included in the file LICENSE-LGPL.txt.
 */
#ifndef MENUBARDELEGATE_H
#define MENUBARDELEGATE_H

#include "Cute4jSwing.h"

#include "ContainerDelegate.h"

// MenuBarDelegate Class. ------------------------------------------------------

/*!
 * \brief MenuBar Delegate.
 *
 * \author Slobodan Vrkacevic
 * \version 0.4.0
 */
class CUTE4J_EXPORT MenuBarDelegate : public ContainerDelegate
{
  Q_OBJECT
protected:
  MenuBarDelegate(JNIEnv *env, jobject obj);
public slots: // native calls
  void insertChild(JNIEnv *env, jlong childDelegate, jint index);
  void removeChild(JNIEnv *env, jlong childDelegate);
public: // native calls
  static jlong newInstance(JNIEnv *env, jobject obj);
public:
  inline QMenuBar *qMenuBar() const;
};

// MenuBarDelegate :: Public Inline Member Function. ---------------------------

/*!
 * \brief Returns QMenuBar adaptee.
 *
 * \return QMenuBar adaptee
 */
inline QMenuBar *MenuBarDelegate::qMenuBar() const
{
  return static_cast<QMenuBar *>(qObject());
}

// Macro Definitions. ----------------------------------------------------------

#define MENU_BAR_CAST(delegate) (reinterpret_cast<MenuBarDelegate *>(delegate))
#define MENU_BAR_DELEGATE MENU_BAR_CAST(delegate)

#endif // MENUBARDELEGATE_H
